#ifndef	__COMMANDPROC_H_
#define __COMMANDPROC_H_

#include "GenericTypeDefs.h"

#define PAYLOAD_LENGTH	10

#define AFN_INIT	0x10
#define AFN_POSITION	0x11
#define	AFN_NORMAL	0x12
#define	AFN_ABNORMAL	0x13

#define	SEQ_REQ		0xE0
#define	SEQ_IND		0xC0

#define IND_TID_DA	0x52
#define IND_CHANNEL_DA	0x10
#define IND_POWER_DA	0x11
#define REQ_STATUS_DA	0x12
#define IND_SLOT_DA	0x30
#define IND_TIME_DA	0x31

typedef struct sReqIndbuf
{
    UINT32 SA;
    UINT8 Length;
    UINT8 AFN; //AFN
    UINT8 SEQ; //SEQ

    union upayload //payload
    {
        UINT8 content[ PAYLOAD_LENGTH ];

        struct sInitInd {
            UINT8 DA1;
            UINT32 Terminal_ID __attribute__((packed));
        } InitInd;

        struct sPositionReq {
            UINT8 DA1;
            UINT8 Terminal_Status;
        } PositionReq;

        struct sPositionInd {
            UINT8 DA1;
            UINT8 Terminal_Channel;
            UINT8 DA2;
            UINT8 Terminal_Power;
            UINT8 DA3;
            UINT16 Terminal_Slot __attribute__((packed));
            UINT8 DA4;
            UINT16 Terminal_Time __attribute__((packed));
        } PositionInd;

        struct sNormalReq {
            UINT8 DA1;
            UINT8 Terminal_status;
        } NormalReq;

        struct sNormalInd {
            UINT8 DA1;
            UINT16 Terminal_Slot __attribute__((packed));
            UINT8 DA2;
            UINT16 Terminal_Time __attribute__((packed));
        } NormalInd;

        struct sAbnormalReq {
            UINT8 DA1;
            UINT8 Terminal_Status;
        } AbnormalReq;

        struct sAbnormalInd {
            UINT8 DA1;
            UINT16 Terminal_Slot __attribute__((packed));
            UINT8 DA2;
            UINT16 Terminal_Time __attribute__((packed));
        } AbnormalInd;
    } payload;
} T_ReqIndbuf;




#endif //__COMMANDPROC_H_
